<template>
	<div class="main-page">
		<el-form ref="form">
			<!-- 搜索栏 -->
			<BaseSearchBar v-on:ChildSearchEvent="getSearchGenceralCustList"></BaseSearchBar>
		</el-form>
		<!-- 表单 -->
		<el-card :body-style="{ padding: '0px' }" class="box-card">
			<div class="tableStyle">
				<Bluetable
					:tHead="tHead"
					:tData="tableData"
					ref="blueTable"
					@operateClick="operateClick">
				</Bluetable>
				<pagination
					:total="query.total"
					:page.sync="query.page"
					:limit.sync="query.limit"
					@pagination="getList"/>
			</div>
		</el-card>
		<!-- 剂量 -->
		<JlDialog ref="jlDialog" :dataObj="jlData" @changeFun="getList"></JlDialog>
		<!-- 相互作用 -->
		<XhzyDialog ref="xhzyDialog" :dataObj="xhzyData" @changeFun="getList"></XhzyDialog>
		<!-- 体外配伍 -->
		<TwpwDialog ref="twpwDialog" :dataObj="twpwData" @changeFun="getList"></TwpwDialog>
		<!-- 超适应症 -->
		<CsyzDialog ref="csyzDialog" :dataObj="csyzData" @changeFun="getList"></CsyzDialog>
		<!-- 儿童 -->
		<EtDialog ref="etDialog" :dataObj="etData" @changeFun="getList"></EtDialog>
		<!-- 成人 -->
		<CrDialog ref="crDialog" :dataObj="crData" @changeFun="getList"></CrDialog>
		<!-- 老人 -->
		<LrDialog ref="lrDialog" :dataObj="lrData" @changeFun="getList"></LrDialog>
		<!-- 妊娠 -->
		<RsDialog ref="rsDialog" :dataObj="rsData" @changeFun="getList"></RsDialog>
		<!-- 性别 -->
		<XbDialog ref="xbDialog" :dataObj="xbData" @changeFun="getList"></XbDialog>
		<!-- 给药途径 -->
		<GytjDialog ref="gytjDialog" :dataObj="gytjData" @changeFun="getList"></GytjDialog>
		<!-- 重复用药 -->
		<CfyyDialog ref="cfyyDialog" :dataObj="cfyyData" @changeFun="getList"></CfyyDialog>
		<!-- 药物禁忌症 -->
		<YwjjzDialog ref="ywjjzDialog" :dataObj="ywjjzData" @changeFun="getList"></YwjjzDialog>
		<!-- 不良反应 -->
		<BlfyDialog ref="blfyDialog" :dataObj="blfyData" @changeFun="getList"></BlfyDialog>
		<!-- 配伍浓度 -->
		<PwndDialog ref="pwndDialog" :dataObj="pwndData" @changeFun="getList"></PwndDialog>
		<!-- 抗菌药物三联重复用药 -->
		<KjywslDialog ref="kjywslDialog" :dataObj="kjywslData" @changeFun="getList"></KjywslDialog>
		<!-- 哺乳用药 -->
		<bryyDialog ref="bryyDialog" :dataObj="bryyData" @changeFun="getList"></BryyDialog>
		<!-- 围术期用药 -->
		<WsqyyDialog ref="wsqyyDialog" :dataObj="wsqyyData" @changeFun="getList"></WsqyyDialog>
		<!-- 肝损害剂量 -->
		<GshjlDialog ref="gshjlDialog" :dataObj="gshjlData" @changeFun="getList"></GshjlDialog>
		<!-- 肾损害剂量 -->
		<SshjlDialog ref="sshjlDialog" :dataObj="sshjlData" @changeFun="getList"></SshjlDialog>
	</div>
</template>

<script>
	import BaseSearchBar from "./components/BaseSearchBar";
	import JlDialog from "./components/jlDialog";
	import XhzyDialog from "./components/xhzyDialog";
	import TwpwDialog from "./components/twpwDialog";
	import CsyzDialog from "./components/csyzDialog";
	import EtDialog from "./components/etDialog";
	import CrDialog from "./components/crDialog";
	import LrDialog from "./components/lrDialog";
	import RsDialog from "./components/rsDialog";
	import XbDialog from "./components/xbDialog";
	import GytjDialog from "./components/gytjDialog";
	import CfyyDialog from "./components/cfyyDialog";
	import YwjjzDialog from "./components/ywjjzDialog";
	import BlfyDialog from "./components/blfyDialog";
	import PwndDialog from "./components/pwndDialog";
	import KjywslDialog from "./components/kjywslDialog";
	import bryyDialog from "./components/bryyDialog";
	import WsqyyDialog from "./components/wsqyyDialog";
	import GshjlDialog from "./components/gshjlDialog";
	import SshjlDialog from "./components/sshjlDialog";
	import getGeneralCustList from "@/api/rad";
	export default {
		name: "MainPage",
		components: {
			BaseSearchBar,
			JlDialog,
			XhzyDialog,
			TwpwDialog,
			CsyzDialog,
			EtDialog,
			CrDialog,
			LrDialog,
			RsDialog,
			XbDialog,
			GytjDialog,
			CfyyDialog,
			YwjjzDialog,
			BlfyDialog,
			PwndDialog,
			KjywslDialog,
			bryyDialog,
			WsqyyDialog,
			GshjlDialog,
			SshjlDialog
		},
		data() {
			return {
				queryInfo: {
					srm: "",
					i_define: "",
				},
				query: {
				  total: 0,
				  page: 1,
				  limit: 10
				},
				tHead: [	
				  {
				    prop: "drugCode",
				    label: "医院药品编码"
				  },
				  {
				    prop: "drugName",
				    label: "医院药品名称"
				  },
				  {
				    prop: "drugUniqueCode",
				    label: "唯一码"
				  },
					{
					  label: "操作(按钮红色表示有通用自定义)",
					  cusoperate:{
						has:"1,3",
						btns:[
							{
							  value: "dosageDefine",
							  label: "剂量"
							},
							{
							  value: "interDefine",
							  label: "相互作用"
							},
							{
							  value: "ivDefine",
							  label: "体外配伍"
							},
							{
							  value: "indicaDefine",
							  label: "超适应症"
							},
							{
							  value: "pediatricDefine",
							  label: "儿童"
							},
							{
							  value: "adultDefine",
							  label: "成人"
							},
							{
							  value: "geriatricDefine",
							  label: "老人"
							},
							{
							  value: "pregnancyDefine",
							  label: "妊娠"
							},
							{
							  value: "sexDefine",
							  label: "性别"
							},
							{
							  value: "routeDefine",
							  label: "给药途径"
							},
							{
							  value: "dupIngGenDefine",
							  label: "重复用药"
							},
							{
							  value: "contrScrDefine",
							  label: "药物禁忌症"
							},
							{
							  value: "reactionDefine",
							  label: "不良反应"
							},
							{
							  value: "compatibilityDefine",
							  label: "配伍浓度"
							},
							{
							  value: "anitDupIngGenDefine",
							  label: "抗菌药物三联重复用药"
							},
							{
							  value: "breastfeedingDefine",
							  label: "哺乳用药"
							},
							{
							  value: "preOperationDefine",
							  label: "围术期用药"
							},
							{
							  value: "liverDamageDefine",
							  label: "肝损害剂量"
							},
							{
							  value: "renalDamageDefine",
							  label: "肾损害剂量"
							}
						],
						activeColor:"#FF0056"
					  },
					  width:"830px",
					  align:"left"
					},
				],
				tableData: [],
				jlData:{},
				xhzyData:{},
				twpwData:{},
				csyzData:{},
				etData:{},
				crData:{},
				lrData:{},
				rsData:{},
				xbData:{},
				gytjData:{},
				cfyyData:{},
				ywjjzData:{},
				blfyData:{},
				pwndData:{},
				kjywslData:{},
				bryyData:{},
				wsqyyData:{},
				gshjlData:{},
				sshjlData:{},
			};
		},
		created: function() {
			// this.tHead[0].cusoperate.btns=this.$utils.customArr();
			// console.log(this.tHead);
			this.getList()
		},
		methods: {
			operateClick (val,item) {
				console.log(val,item)
				if(val.label == "剂量"){
					this.jlData=item;
					this.$refs.jlDialog.show();
				}else if(val.label == "相互作用"){
					this.xhzyData=item;
					this.$refs.xhzyDialog.show();
				}else if(val.label == "体外配伍"){
					this.twpwData=item;
					this.$refs.twpwDialog.show();
				}else if(val.label == "超适应症"){
					this.csyzData=item;
					this.$refs.csyzDialog.show();
				}else if(val.label == "儿童"){
					this.etData=item;
					this.$refs.etDialog.show();
				}else if(val.label == "成人"){
					this.crData=item;
					this.$refs.crDialog.show();
				}else if(val.label == "老人"){
					this.lrData=item;
					this.$refs.lrDialog.show();
				}else if(val.label == "妊娠"){
					this.rsData=item;
					this.$refs.rsDialog.show();
				}else if(val.label == "性别"){
					this.xbData=item;
					this.$refs.xbDialog.show();
				}else if(val.label == "给药途径"){
					this.gytjData=item;
					this.$refs.gytjDialog.show();
				}else if(val.label == "重复用药"){
					this.cfyyData=item;
					this.$refs.cfyyDialog.show();
				}else if(val.label == "药物禁忌症"){
					this.ywjjzData=item;
					this.$refs.ywjjzDialog.show();
				}else if(val.label == "不良反应"){
					this.blfyData=item;
					this.$refs.blfyDialog.show();
				}else if(val.label == "配伍浓度"){
					this.pwndData=item;
					this.$refs.pwndDialog.show();
				}else if(val.label == "抗菌药物三联重复用药"){
					this.kjywslData=item;
					this.$refs.kjywslDialog.show();
				}else if(val.label == "哺乳用药"){
					this.bryyData=item;
					this.$refs.bryyDialog.show();
				}else if(val.label == "围术期用药"){
					this.wsqyyData=item;
					this.$refs.wsqyyDialog.show();
				}else if(val.label == "肝损害剂量"){
					this.gshjlData=item;
					this.$refs.gshjlDialog.show();
				}else if(val.label == "肾损害剂量"){
					this.sshjlData=item;
					this.$refs.sshjlDialog.show();
				}
			},
			async getList() {
				let _this = this;
				let res = await this.$rad.getGeneralCustList({
					srm: _this.queryInfo.srm,
					i_define: _this.queryInfo.i_define,
					page: _this.query.page,
					pageSize: _this.query.limit,
				})
				this.tableData = res.rows
				this.query.total = res.total
			},
			getSearchGenceralCustList(data) {
				this.queryInfo.srm = data.srm;
				this.queryInfo.i_define = data.i_define;
				this.query.pagesize=1;
				this.getList()
			},
		}

	}
</script>
<style scoped>
	
</style>
